package com.colabo.j2ee.web.oaf.security.impl;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;

public class CustomAuthenticationFailureHandler implements
		AuthenticationFailureHandler {
	// Instance Fields =====================================
	private String authenticationFailurePage;
	
	// Methods ==============================================
	public String getAuthenticationFailurePage() {
		return authenticationFailurePage;
	}
	
	public void setAuthenticationFailurePage(String authenticationFailurePage) {
		this.authenticationFailurePage = authenticationFailurePage;
	}
	
	public void onAuthenticationFailure(
			HttpServletRequest paramHttpServletRequest,
			HttpServletResponse paramHttpServletResponse,
			AuthenticationException paramAuthenticationException)
			throws IOException, ServletException {
		// TODO Auto-generated method stub
		paramHttpServletResponse.sendRedirect(authenticationFailurePage);
	}

}
